<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main" />
    <g:set var="entityName" value="${message(code: 'assess.label', default: 'Assess')}" />
    <title>开发商入围列表</title>
</head>
<body>
<div class="small-header transition animated fadeIn">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right navFloatRight">
                <ol class="hbreadcrumb breadcrumb">
                    <li>CINDATA PLS</li>
                    <li class="active">
                        <span>开发商入围列表</span>
                    </li>
                </ol>
            </div>
            <h2 class="font-light m-b-xs">
                开发商入围列表
            </h2>
        </div>
    </div>
</div>

<div class="content animate-panel">
    <div class="row">
        <g:form method="POST" action="index">
            <div class="hpanel hgreen">

                <div class="panel-heading">
                    <div class="panel-tools">
                        <button class="btn btn-primary btn-xs" type="submit"><i class="fa fa-search"></i>查询</button>
                        <button class="btn btn-warning2 btn-xs" type="button" id="resetBtn">
                            <i class="fa fa-times"></i>重置</button>
                    </div>
                    查询
                </div>

                <div class="panel-body form-horizontal">

                    <div class="row ">
                        <div class="form-group col-sm-4">
                            <label for="city" class="col-sm-3 control-label">城市</label>
                            <div class="col-sm-9">
                                <g:select class="form-control" name="city" id="city" from="${com.cindata.City.findAllByNameInList(new com.cindata.ComponentService().evaluate(com.cindata.Component.findByCode('showCity')), [sort: 'name', order: 'asc'])}"
                                          valueMessagePrefix="status" optionKey="zoneNumber" optionValue="name"
                                          value="${params?.city}"
                                          noSelection="${["-1": '请选择城市']}"/>
                            </div>
                        </div>
                        <div class="form-group col-sm-4">
                            <label for="district" class="col-sm-3 control-label">行政区</label>
                            <div class="col-sm-9">
                                <g:select class="form-control" name="district" id="district"
                                          from="${districtList}"
                                          valueMessagePrefix="status" optionKey="zoneNumber" optionValue="name"
                                          value="${params?.district}"
                                          noSelection="${["null": '请选择行政区']}"/>
                            </div>
                        </div>
                        <div class="form-group col-sm-4">
                            <label for="city" class="col-sm-3 control-label">开发商名称</label>
                            <div class="col-sm-9">
                                <g:select class="form-control" name="name" id="name" from="${com.cindata.Developer.list()}"
                                          valueMessagePrefix="status" optionKey="name" optionValue="name"
                                          value="${params?.city}"
                                          noSelection="${["-1": '请选择开发商']}"/>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </g:form>


        <div class="hpanel hgreen">
            <div class="panel-heading">
                已入围开发商
            </div>

            <div class="panel-body no-padding">
                <div class="table-responsive">
                    <table cellpadding="1" cellspacing="1" class="table table-striped table-bordered table-hover text-center" id="esateTable">
                        <thead>
                        <tr>

                            <g:sortableColumn property="externalId" title="开发商名称"   params="${params}"/>
                            <g:sortableColumn property="batch" title="单位性质"   params="${params}"/>
                            <g:sortableColumn property="buildingType" title="统一社会信用代码"    params="${params}"/>
                            <g:sortableColumn property="estateStatus" title="企业状态"   params="${params}"/>
                            <g:sortableColumn property="name" title="经营状态"    params="${params}"/>
                            <g:sortableColumn property="city" title="注册资金(单位:万)"    params="${params}"/>
                            <g:sortableColumn property="district" title="开发资质"    params="${params}"/>
                            <g:sortableColumn property="fullName" title="开发商信用等级"    params="${params}"/>
                            <g:sortableColumn property="sourceAddress" title="企业法定代表人资信"   params="${params}"/>
                            <g:sortableColumn property="sourceBuildArea" title="企业涉诉情况"   params="${params}"/>
                            <g:sortableColumn property="registerFullName" title="资产负债率"   params="${params}"/>
                            <g:sortableColumn property="registerAccount" title="入围状态"    params="${params}"/>
                            <g:sortableColumn property="registerDate" title="企业地址"    params="${params}"/>
                            <g:sortableColumn property="registerDate" title="操作项"    params="${params}"/>

                        </tr>
                        </thead>
                        <tbody>
                        <g:each in="${list}" >
                        <tr>
                            <td><g:link controller="developer" action="detailn"  params="${["companyId":it?.companyId]}">${it?.name}</g:link></td>
                            <td>${it?.unitNature?.name ? it?.unitNature?.name : '-'}</td>
                            <td>${it?.unifiedSocialCreditCode ? it?.unifiedSocialCreditCode : '-'}</td>
                            <td>${it?.status ? it?.status  : '-'}</td>
                            <td>${it?.operatingState ? it?.operatingState : '-'}</td>
                            <td>${it?.registeredCapital ? it?.registeredCapital : '-'}</td>
                            <td>${it?.qualificationGrade ? it?.qualificationGrade : '-'}</td>
                            <td>${it?.creditRating ? it?.creditRating : '-'}</td>
                            <td>${it?.legalRepresentative ? it?.legalRepresentative : '-'}</td>
                            <td>${it?.caseOfComplaintAmount ? it?.caseOfComplaintAmount : '-'}</td>
                            <td>${it?.assetRatio ? it?.assetRatio : '-'}</td>
                            <td>${it?.entryStatus ? it?.entryStatus : '-'}</td>
                            <td>${it?.address ? it?.address : '-'}</td>
                            <td>
                                <button class="btn btn-success btn-xs btn-outline" type="button" >
                                    <i class="fa"></i>
                                    取消入围
                                </button>

                            </td>
                        </tr>
                            </g:each>
                        </tbody>
                    </table>
                </div>
            </div>

            <div class="panel-footer">
                <div class="pagination">
                    <g:paginate total="${assessCount ?: 0}" params="${params}"/>
                </div>
            </div>
        </div>
    </div>

    <g:javascript>
        $(function () {

            $('#datepicker').datepicker({
                language: 'zh-CN'
            });
            $("#datepicker").on("changeDate", function(event) {
                $("#my_hidden_input").val(
                        $("#datepicker").datepicker('getFormattedDate')
                )
            });
            $("#city").bind("change", function(){
            if('${params.district}'== $("#district option:selected").val()&&flag!=true && '${params.district}' != '-1'){
                flag=true
                return
            }
            $("#district option").remove();
            $("#s2id_district span:first").html("请选择行政区");
            var city = $("#city").val()
            $("#district").append("<option value='-1' >请选择行政区</option>")
            if(city=='-1'){
                return
            }
            $.ajax({
                url: "/estate/districtList",
                type: "POST",
                data: {'city': city} ,
                success: function(result){
                    for(var i=0; i < result.districtList.length; i++){
                        $("#district").append("<option value=" + result.districtList[i].zoneNumber + ">" + result.districtList[i].name + "</option>")
                    }
                }
            });
        });
        $("#city").change();
        });
    </g:javascript>
</body>
</html>